package com.hxm.appGenealogy.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

@Configuration
public class MyPool {

    @Bean
    public ExecutorService executorService(){
       return new ThreadPoolExecutor(
                10,
                1000,
                1,
                TimeUnit.MINUTES,
                new ArrayBlockingQueue<>(500),
                Executors.defaultThreadFactory(),
                    new ThreadPoolExecutor.DiscardOldestPolicy()
                );
    }
}
